"""
Case Type   : 服务端工具
Case Name   : omm用户检查操作系统信息
Create At   : 2024/09/26
Owner       : @chen
Description :
    omm用户检查操作系统信息
Expect      :
    执行成功
History     :
"""
import unittest
from yat.test import Node
from yat.test import macro
from testcase.utils.Constant import Constant
from testcase.utils.Logger import Logger

logger = Logger()


class Tools(unittest.TestCase):
    def setUp(self):
        logger.info('--------------Opengauss_Function_Tools_gs_checkos_Case0073start-------------------')
        self.dbuserNode = Node('dbuser')
        self.Constant = Constant()

    def test_server_tools1(self):
        logger.info('------------------omm用户检查操作系统信息------------------')
        checkos_cmd = f'''
                                    source {macro.DB_ENV_PATH}
                                    gs_checkos  -i A
                                    '''
        logger.info(checkos_cmd)
        msg = self.dbuserNode.sh(checkos_cmd).result()
        logger.info(msg)
        self.assertIn('A1.',msg)
        self.assertIn('A2.',msg)
        self.assertIn('A3.',msg)
        self.assertIn('A4.',msg)
        self.assertIn('A5.',msg)
        self.assertIn('A8.',msg)
        self.assertIn('A12.',msg)
        self.assertIn('A13.',msg)

    def tearDown(self):
        logger.info('--------------无需清理环境-------------------')
        logger.info('------------------Opengauss_Function_Tools_gs_checkos_Case0073finish------------------')
